package com.jade.bss.base.account;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;

/**
 * 账户记录。
 *
 * @author dwzhang
 * @version 1.0 12-04-22 下午9:08
 */
@Entity
@Table (name = "BSS_RECORD_ACCOUNT")
public class AccountRecord
        implements Serializable
{
    public static final String ACCOUNT_CHARGE = "charge";
    public static final String ACCOUNT_BONUS = "bonus";
    public static final String ACCOUNT_BONUS_CHANGE = "bonus_change";
    public static final String ACCOUNT_BONUS_DELETE = "bonus_delete";
    public static final int RECORD_UNPAID = 0;
    public static final int RECORD_PAID = 1;

    /** 账户标识 */
    @Id
    @GeneratedValue (generator = "SEQ_ACC_RECORD")
    @SequenceGenerator (name = "SEQ_ACC_RECORD", sequenceName = "SEQ_ACC_RECORD")
    private long id;
    /** 账户标识 */
    @Column (name = "account_id", nullable = false)
    private long accountId;
    /** 标识 */
    @Column (name = "owner_id", nullable = false)
    private String ownerId;
    /** 标识 */
    @Column (name = "owner_type", nullable = false)
    private String ownerType;
    /** 账户类型，冗余 */
    @Column (name = "type", nullable = false)
    private String type;
    /** 操作额度 */
    @Column (name = "amount", nullable = false)
    private long amount;
    /** 金额，以分为单位 */
    @Column (name = "fee", nullable = false)
    private long fee;
    /** 操作类型，包括充值、预扣、预扣确认、扣费 */
    @Column (name = "operation", nullable = false, length = 16)
    private String op;
    /** 操作时间 */
    @Column (name = "op_date", nullable = false)
    private Date opDate;
    /** 关联记录ID,用于预扣和确认等操作 */
    @Column (name = "parent_id")
    private long parent;
    /**
     * 账户记录状态
     */
    private int status;

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }

    public long getAccountId()
    {
        return accountId;
    }

    public void setAccountId(long accountId)
    {
        this.accountId = accountId;
    }

    public String getOwnerId()
    {
        return ownerId;
    }

    public void setOwnerId(String ownerId)
    {
        this.ownerId = ownerId;
    }

    public String getOwnerType()
    {
        return ownerType;
    }

    public void setOwnerType(String ownerType)
    {
        this.ownerType = ownerType;
    }

    public String getType()
    {
        return type;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public String getOp()
    {
        return op;
    }

    public void setOp(String op)
    {
        this.op = op;
    }

    public Date getOpDate()
    {
        return opDate;
    }

    public void setOpDate(Date opDate)
    {
        this.opDate = opDate;
    }

    public long getAmount()
    {
        return amount;
    }

    public void setAmount(long amount)
    {
        this.amount = amount;
    }

    public long getFee()
    {
        return fee;
    }

    public void setFee(long fee)
    {
        this.fee = fee;
    }

    public long getParent()
    {
        return parent;
    }

    public void setParent(long parent)
    {
        this.parent = parent;
    }

    public int getStatus()
    {
        return status;
    }

    public void setStatus(int status)
    {
        this.status = status;
    }
}
